# -*- coding: utf-8 -*-

#    Copyright (C) 2014 by Promotux
#                       di Francesco Meloni snc - http://www.promotux.it/

#    Author: Francesco Meloni  <francesco@promotux.it>

#    This file is part of OdCollect.

#    OdCollect is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 2 of the License, or
#    (at your option) any later version.

#    OdCollect is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with OdCollect.  If not, see <http://www.gnu.org/licenses/>.



import datetime
from sqlalchemy import *
from Environment import *
#from web_lib.webutils import leggiInSessione
try:
    t_operatore = Table('operatore', meta,
        Column('id', Integer, primary_key=True),
        Column('username', String(50), nullable=False),
        Column('password', String(50), nullable=False),
        Column('email', String(70), nullable=True),
        Column('cognome', String(70), nullable=True),
        Column('nome', String(70), nullable=True),
        Column('registration_date', DateTime,ColumnDefault(datetime.datetime.now)),
        Column('last_modified', DateTime),
        Column('photo', Text, nullable=True),
        Column('icona', Text, nullable=True),
        Column('cellulare', String(50), nullable=True),
        Column('f_qrcode', Text, nullable=True),
        Column('f_ean', Text, nullable=True),
        Column('f_imei', String(50), nullable=True),
        Column('f_idreg', String(50), nullable=True),
        Column('data_nascita', DateTime),
        Column('active', Boolean, default=False),
        Column('tipo_operatore', String(50), nullable=True),
        Column('genere', String(10), nullable=True),
        Column('privacy', Boolean, default=False),
        Column('mailing_list', Boolean, default=False),
        schema=leggiInSessione(sezione="Main", chiave="schema"),
        extend_existing=True
            )
    t_operatore.create(checkfirst=True)
except:
    print "ERRORE in data operatore"
